package ex7;

import java.util.LinkedList;
import java.util.Scanner;


public class Test4 {
	static boolean first = true;
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		
		int n = scanner.nextInt();
		
		LinkedList<Integer> linkedList1 = new LinkedList<Integer>();
		LinkedList<Integer> linkedList2 = new LinkedList<Integer>();
		
		for (int i = 1; i <= n; i++) {
			int x = scanner.nextInt();
			if (x % 2 == 0) {
				linkedList2.offer(x);
			} else {
				linkedList1.offer(x);
			}
		}
		
		boolean first = true;
		while (!linkedList1.isEmpty() && !linkedList2.isEmpty()) {
			dosth();
			System.out.print(linkedList1.poll());
			if (!linkedList1.isEmpty()) {
				dosth();
				System.out.print(linkedList1.poll());
			}
			dosth();
			System.out.print(linkedList2.poll());
		}
		
		
		while (!linkedList1.isEmpty()) {
			dosth();
			System.out.print(linkedList1.poll());
		}
		
		while (!linkedList2.isEmpty()) {
			dosth();
			System.out.print(linkedList2.poll());
		}
		
		
		
		
		
		
		
		scanner.close();
	}

	private static void dosth() {
		// TODO Auto-generated method stub
		if (first) {
			first = false;
		} else {
			System.out.print(" ");
		}
		
	}
}